package zhishu.iceyyy.com.bxq_2500.myadapter;

import android.app.Activity;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import java.util.List;

import zhishu.iceyyy.com.bxq_2500.R;
import zhishu.iceyyy.com.bxq_2500.base.Base_Z_Adapter;
import zhishu.iceyyy.com.bxq_2500.bean.MoviceDetail;
import zhishu.iceyyy.com.bxq_2500.bean.MovielistD;
import zhishu.iceyyy.com.bxq_2500.utils.BitmapTrans;

public class Grid2ViewAdapter extends Base_Z_Adapter {

    public Activity context;


    public Grid2ViewAdapter(Activity context) {
        this.context = context;


        bitmapTrans = new BitmapTrans();
    }


    private BitmapTrans bitmapTrans;

    @Override
    public View getView(final int position, View view, ViewGroup arg2) {
        final Holder holder;
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.item_grid2view, null);
            holder = new Holder();
            holder.imageView = (ImageView) view.findViewById(R.id.iv_girl);
            holder.textView = (TextView) view.findViewById(R.id.tv);
            holder.tv_tishi = (TextView) view.findViewById(R.id.tv_tishi);

            view.setTag(holder);
        } else {
            holder = (Holder) view.getTag();
        }
        MoviceDetail.DataBean.MovicesBean.MoviceBean item = (MoviceDetail.DataBean.MovicesBean.MoviceBean) getItem(position);
        Picasso.with(context).load(item.getVod_pic()).transform(bitmapTrans).config(Bitmap.Config.RGB_565).placeholder(context.getDrawable(R.drawable.bg_holder_brown)).into(holder.imageView);
        holder.textView.setText(item.getVod_name());
        holder.tv_tishi.setText(item.getVod_remarks());
        return view;
    }

    class Holder {
        ImageView imageView;
        TextView textView,tv_tishi;
    }


}
